// import params from "/@/utils/params"
import request from '/@/utils/request';

interface SearchPatientParams {
	username?: string;
	medicalCard?: string;
}

interface AddBloodGlucoseParams {
	customerId: number;
	isFasting: string;
	num: number;
}

export function fetchList(query?: Object) {
	return request({
		url: '/blood/bloodxCustomerBlood/page',
		method: 'get',
		params: query,
	});
}

export function addObj(obj?: Object) {
	return request({
		url: '/blood/bloodxCustomerBlood',
		method: 'post',
		data: obj,
	});
}

export function getObj(id?: string) {
	return request({
		url: '/blood/bloodxCustomerBlood/' + id,
		method: 'get',
	});
}

export function delObjs(ids?: Object) {
	return request({
		url: '/blood/bloodxCustomerBlood',
		method: 'delete',
		data: ids,
	});
}

export function putObj(obj?: Object) {
	return request({
		url: '/blood/bloodxCustomerBlood',
		method: 'put',
		data: obj,
	});
}

// get  /admin/bloodxCustomerBlood/getAvgValue
export function getAvgValue(params?: Object) {
	return request({
		url: '/blood/bloodxCustomerBlood/getAvgValue',
		method: 'post',
		data: params,
	});
}

export function getexaminlist(query?: Object) {
	return request({
		url: '/blood/bloodxPhysicalExaminationData/page',
		method: 'get',
		params: query,
	});
}

export function getdetaillist(query?: Object) {
	return request({
		url: '/blood/bloodxPhysicalExaminationData/list',
		method: 'get',
		params: query,
	});
}

export function medicalViewBloodStatisticalChart(params?: Object) {
	return request({
		url: '/blood/bloodxCustomerBlood/medicalViewBloodStatisticalChart',
		method: 'get',
		params: params,
	});
}

///admin/bloodxCustomerBlood/medicalViewPage
export function medicalViewPage(query?: Object) {
	return request({
		url: '/admin/bloodxCustomerBlood/medicalViewPage',
		method: 'get',
		params: query,
	});
}

export function getBoarderName() {
	return request({
		url: '/admin/bloodxCustomerBlood/getBoarderName',
		method: 'get',
	});
}

// 根据姓名和卡号查询患者
export function getCustomerByNameAndMedicalCard(params: SearchPatientParams) {
	return request({
		url: '/admin/bloodxCustomerSpecial/getCustomerByConditions',
		method: 'get',
		params,
	});
}

// 补录血糖
export function addBloodGlucose(data: AddBloodGlucoseParams) {
	return request({
		url: '/admin/bloodxCustomerBlood/addRecordBlood',
		method: 'post',
		data,
	});
}
